﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace XGameFrame
{
    /// <summary>
    /// Class to hold information about one cell of a map
    /// </summary>
    public class FieldCell
    {
        #region Field Region
		private const int DEFAULT_FIELD_CELL = 0;
        private List<int> groundFields = new List<int>();
        private List<int> heightFields = new List<int>();
        private List<int> overlayFields = new List<int>();
	    #endregion

        #region Property Region
		/// <summary>
        /// Get ID of a field type or set it
        /// </summary>
        public int FieldID
        {
            //Always returns groundbase, no return possibility of layers...did we need smth like that?
            get { return groundFields[0]; }
            set 
            {
                 groundFields.Add(value);
            }
        }

        /// <summary>
        /// Get the whole Content of a map Cell which have to drawn on a map
        /// </summary>
        public List<int> GroundFields
        {
            get { return groundFields; }
        }

        /// <summary>
        /// Get the whole Content of a map Cell which have to drawn on a map
        /// </summary>
        public List<int> HeightFields
        {
            get { return heightFields; }
        }

        /// <summary>
        /// Get the whole Content of a map Cell which have to drawn on a map
        /// </summary>
        public List<int> OverlayFields
        {
            get { return overlayFields; }
        }
	    #endregion

        /// <summary>
        /// Creates a new Field
        /// </summary>
        /// <param name="pFieldID">The type of field which should be added</param>
        public FieldCell(int pFieldID = DEFAULT_FIELD_CELL )
        {
            groundFields.Add(pFieldID);
        }

        /// <summary>
        /// Add a various number of field ids to a field.
        /// </summary>
        /// <param name="pIDs">Field ids to add</param>
        public void AddMultipleGroundFields(params int[] pIDs)
        {
            foreach(int _fieldID in pIDs)
                groundFields.Add(_fieldID);
        }

        /// <summary>
        /// Add a various number of heightfield ids to a field.
        /// </summary>
        /// <param name="pIDs">Field ids to add</param>
        public void AddMultipleHeightFields(params int[] pIDs)
        {
            foreach(int _fieldID in pIDs)
                heightFields.Add(_fieldID);
        }

        /// <summary>
        /// Add a various number of heightfield ids to a field.
        /// </summary>
        /// <param name="pIDs">Field ids to add</param>
        public void AddMultipleOverlayFields(params int[] pIDs)
        {
            foreach(int _fieldID in pIDs)
                overlayFields.Add(_fieldID);
        }
    }
}
